<?php
/**
 * Copyright (C) 2010-2013 Oscar Valenzuela B. (ovalenzuela@xpertians.com)
 * 
 * This file is part of WarpIT.
 * WarpIT is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 * 
 * WarpIT is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with WarpIT.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * This class cointains Info Requests methods for WarpIT
 * @author Oscar Valenzuela <ovalenzuela@xpertians.com>
 * @version 1.0
 * @package WarpIT!
 * @copyright Copyright (C) 2010-2013 Xpertians SpA
 * @license GNU GPLv3 or later
 * @link http://www.xpertians.com
 */
 
Class Request{
	
	/**
	 * Config information
	 *
	 * @var mixed
	 */
	private $config;
	
	/**
	 * Results container
	 *
	 * @var mixed
	 */
	private $response;
	
	/**
	 * Request Get info from HSS and HLR provisioning
	 *
	 */
	function Request(){
		include_once("Vendors/HLR_Online/config.php");
		$this->config		= $config;
	}
	
	/**
	 * Request_MSISDN Get info from HSS and HLR provisioning
	 *
	 * Following syntax are recognized :
	 *
	 * @param string $MSISDN Phone number
	 * @param string $view Display Format
	 * @return array
	 */
	function Request_MSISDN($MSISDN,$view){
		/* clasification table */
		$requestType		= "hlr";
		$requestHost		= "hss";
		
		switch($requestType){
			case "hlr":
				$this->response		= $this->Request_info_hlr($MSISDN,$view);
			break;
		}
		
		return $this->response;
	}
	
	/**
	 * Request_info_hlr Get info from HLR and parse the results
	 *
	 * Following syntax are recognized :
	 *
	 * @param string $MSISDN Phone number with country code
	 * @param string $view Display Format
	 * @return array
	 */
	 function Request_info_hlr($MSISDN,$view){
		$req_hlr		= new Request_HLR($this->config);
		$IMSIinfo		= $req_hlr->Request_FNR($MSISDN);
		if($IMSIinfo!=""){
			$resp_hlr	= $req_hlr->Request_HLRQRY($MSISDN,$IMSIinfo);
			if($view!="html"){
				return split("\n", $resp_hlr);
			}else{
				return $req_hlr->Parse_HLRQRY($resp_hlr);



			}
		}else{
			return array();
		}
	 }
}
?>
